package com.shuai.chatroom.config;

import com.shuai.chatroom.common.HttpResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class ExceptionUtils {

    @ExceptionHandler(Exception.class)
    public Object exceptionHandler(Exception e) {
        return HttpResult.fail(-1, e.getMessage());
    }
}
